// 后台门户配置
import request from '@/utils/request'

const api = {
  getList: '/businessmenu',
  addOrUpdateWeb: '/businessmenu',
  getMenuTree: '/businessmenu/tree',
  getTreeDetailPage: '/businessmenu/treeDetailPage',
  getRangeTreeList: '/jxsl-office/'
}

// 搜索列表
export function getList (params = {}) {
  return request({
    url: `${api.getList}`,
    method: 'get',
    params
  })
}
// 查全部列表
export function getTreeDetailPage (params = {}) {
  return request({
    url: `${api.getTreeDetailPage}`,
    method: 'get',
    params
  })
}

// 新增门户
export function addWeb (data = {}) {
  return request({
    url: api.addOrUpdateWeb,
    method: 'post',
    data
  })
}

// 修改门户
export function updateWeb (data = {}) {
  return request({
    url: api.addOrUpdateWeb,
    method: 'put',
    data
  })
}

// 根据id查详情
export function getWebDetail (id = '') {
  return request({
    url: `${api.addOrUpdateWeb}/${id}`,
    method: 'get'
  })
}

// 根据id删除
export function deleteWeb (id = '') {
  return request({
    url: `${api.addOrUpdateWeb}/${id}`,
    method: 'delete'
  })
}

// 根据id删除
export function getMenuTree (params = {}) {
  return request({
    url: `${api.getMenuTree}`,
    method: 'get',
    params
  })
}

// 使用范围
export function getRangeTreeList (params = {}) {
  return request({
    url: `${api.getRangeTreeList}`,
    method: 'get',
    params
  })
}
